package com.cll.prototype.user.controller.service.captcha;

import com.cll.prototype.common.dto.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 描述信息:
 * 远程调用验证码微服务下的控制层接口
 * @author CLL
 * @version 1.0
 * @date 2020/10/29 9:34
 */
@FeignClient(name = "service-captcha",
        path = "/auth_captcha",
        qualifier = "authCaptchaControllerFeignClient",
        fallback = AuthCaptchaControllerFeignClientFallback.class
)
public interface AuthCaptchaControllerFeignClient {

    /**
     * 1. 生成验证码
     * 2. 存储到数据库
     * 3. 调用扇出邮箱微服务发送
     * @param email 邮箱
     * @return  发送结果
     */
    @PostMapping(value = "/createRegisterCaptcha")
    public AjaxResult createRegisterCaptcha(@RequestParam("email") String email);

    /**
     * 校验验证码
     * @param email 邮箱号码
     * @param captcha   验证码
     * @return  检测结果
     */
    @PostMapping(value = "/checkCaptcha")
    public AjaxResult checkCaptcha(@RequestParam("email") String email,
                                   @RequestParam("captcha") String captcha);
}